package c.j.a.c.g$d;

import c.j.a.c.g$g.a;
import c.j.a.c.g.y;
import java.util.Iterator;
import java.util.concurrent.CopyOnWriteArrayList;
import org.json.JSONObject;

/* compiled from: AdDownloadDialogSpHelper */
public class c {
    public void a(String str, String str2, CopyOnWriteArrayList<a> copyOnWriteArrayList) {
        if (copyOnWriteArrayList != null) {
            JSONObject jSONObject = new JSONObject();
            try {
                Iterator it = copyOnWriteArrayList.iterator();
                while (it.hasNext()) {
                    a aVar = (a) it.next();
                    if (aVar != null) {
                        jSONObject.put(String.valueOf(aVar.b), aVar.b());
                    }
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
            y.a().getSharedPreferences(str, 0).edit().putString(str2, jSONObject.toString()).apply();
        }
    }
}
